<template>
  <div class="rights">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <el-table :data="tableData" :border="true" stripe style="width: 100%">
        <el-table-column label="#" type="index"></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="path"></el-table-column>
        <el-table-column label="权限等级" prop="level">
          <template slot-scope="scope">
            <el-tag
              :type="parseInt(scope.row.level) + 1 == 1 ? 'primary' : parseInt(scope.row.level) + 1 == 2 ? 'success' : 'warning'"
              disable-transitions>
              {{ 1 + parseInt(scope.row.level) + '级' }}
            </el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //测试数据
      tableData: []
    }
  },
  created() {
    this.getlist()
  },
  methods: {
    async getlist() {
      let { data: res } = await this.$http.get(`rights/list`);
      if (res.meta.status !== 200) return this.$message.error(res.meta.msg);
      this.tableData = res.data;

    }
  },
}
</script>

<style lang="scss" scoped>
</style>